-if @message_thread
  -@page_title = @message_thread.parent_message.sender.login + ':' + @message_thread.parent_message.subject
-else
  -@page_title= @message.subject

=render :partial => 'messages/sidebar_nav'

-unless @message_thread
  .pull-right= h I18n.l(@message.created_at, :format => :literal_date)            
  %pre.clear.message_body= auto_link @message.body      
-else
  .pull-right= h I18n.l(@message_thread.parent_message.created_at, :format => :literal_date)                  
  %pre.clear.message_body= auto_link @message_thread.parent_message.body

  - children = @message_thread.parent_message.children
  - children.each do |child|      
    .right=h I18n.l(child.created_at, :format => :literal_date)
    %em
      =child.sender.login
      \:
    %br
    %pre.message_body= auto_link child.body
    %br
      
-if @reply    
  %ul.message_nav
    %li.sent= link_to :reply.l, new_user_message_path(@user, :reply_to => @message), :onclick => "$('#reply').toggle(); $('#dummy_reply').toggle(); $('#message_body').focus(); $('.sent').toggle(); return false;"

  %form.MainForm#dummy_reply
    %textarea{:onclick => "$('#reply').toggle(); $('#message_body').focus(); $('#dummy_reply').hide(); $(this).blur(); $('.sent').toggle(); return false;", :style => "height: 75px;"}

  #reply{:style => "display:none;"}=render :partial => 'form', :locals => {:message => @reply, :user => @user}
